package com.project.andeper.paperproject;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.wyk.greendaodemo.greendao.gen.HourData;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;

public class MainActivity extends AppCompatActivity {

    DBManager dbManager;

    @BindView(R.id.tv_content)
    TextView tvContent;
    @BindView(R.id.buttonMonth)
    Button buttonMonth;
    @BindView(R.id.buttonHour)
    Button buttonHour;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        dbManager = DBManager.getInstance(this);
        /*dbManager = DBManager.getInstance(this);
        for (int i = 0; i < 5; i++) {
            User user = new User();
            user.setId(Long.valueOf(i));
            user.setUsername("user"+String.valueOf(i));
            user.setPassword("password"+String.valueOf(i));
            dbManager.insertUser(user);
        }*/
    }



    @OnTextChanged(R.id.tv_content)
    public void onTextChanged() {
        Toast.makeText(this, "改变", Toast.LENGTH_SHORT).show();
    }

    @OnClick({R.id.buttonMonth, R.id.buttonHour})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.buttonMonth:
                Intent intentMonth = new Intent(MainActivity.this,ChooseMethodActivity.class);
                startActivity(intentMonth);

                break;
            case R.id.buttonHour:
                Intent intent = new Intent(MainActivity.this, QueryHourActivity.class);
                startActivity(intent);
                break;
        }
    }
}
